<div id="profil">

    <h1><?=$person->fullname()?><span class="close">x</span></h1>

    <img src="<?=$person->photo?>" class="pic" />

    <div class="item">
        <span class="label fixe">firstname</span>
        <span class="value"><?=$person->firstnames?></span>
    </div>

    <div class="item">
        <span class="label fixe">lastname</span>
        <span class="value"><?=$person->lastname?></span>
    </div>

    <div class="item">
        <span class="label fixe">nickname</span>
        <span class="value"><?=$person->nickname?></span>
    </div>

    <div class="item">
        <span class="label fixe">genre</span>
        <span class="value"><?=$person->gender?></span>
    </div>

    <div class="clearfix"></div>

    <?php if($relation = $person->relation()): ?>
    <div class="sep"></div>
    <div class="item">
        <span class="label">in couple with</span>
        <span class="value"><?= $relation->person2()->fullname() ?></span>
    </div>
    <?php endif; ?>

    <?php if($events = $person->events()): ?>
    <div class="sep"></div>
    <?php foreach($events as $event): ?>
    <div class="item">
        <span class="label"><?=$event->name()?></span>
        <span class="value"><?=$event->date()?></span>
        <span class="label">at</span>
        <span class="value"><?=$event->place?></span>
    </div>
    <?php endforeach; ?>
    <?php endif; ?>

    <div class="sep"></div>

    <div class="item actions ajax-form">

        <a href="<?php echo url('person/edit/' . $person->id) ?>">Edit</a>

        <?php if(!$relation): ?>
        <a href="<?php echo url('add/relation/' . $person->id) ?>">Add relation</a>
        <?php endif; ?>

        <?php if($relation): ?>
        <a href="<?php echo url('add/child/' . $relation->id) ?>">Add child</a>
        <?php endif; ?>

        <?php if(!$person->parents()): ?>
        <a href="<?php echo url('add/parents/' . $person->id) ?>">Add parents</a>
        <?php endif; ?>

    </div>

</div>